package cn.jellybmedia.system.service.impl;

import cn.jellybmedia.basic.service.impl.BaseServiceImpl;
import cn.jellybmedia.system.domain.DictionaryType;
import cn.jellybmedia.system.mapper.DictionaryDetailMapper;
import cn.jellybmedia.system.mapper.DictionaryTypeMapper;
import cn.jellybmedia.system.service.IDictionaryTypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

/**
* @Description: service层实现类
* @Author: Mr.Zhang
* @Version: 1.0
* @Date:  2022/6/21 18:10  
*/

@Service
@Transactional(readOnly = true,propagation = Propagation.SUPPORTS)
public class DictionaryTypeImpl extends BaseServiceImpl<DictionaryType> implements IDictionaryTypeService {

    @Autowired
    private DictionaryDetailMapper dictionaryDetailMapper;

    @Autowired
    private DictionaryTypeMapper dictionaryTypeMapper;

    @Override
    public void remove(Long id) {

        dictionaryDetailMapper.removeByType(id);
        dictionaryTypeMapper.remove(id);

    }

    @Override
    public void batchDel(Long[] ids) {
        for(int i=0;i<ids.length;i++){
            dictionaryDetailMapper.removeByType(ids[i]);
        }
        dictionaryTypeMapper.batchDel(ids);
    }



}
